-- card: 2852 from stack: in -- bmap block id: 2180 -- flags: 4000 -- background id: 2592 -- name: -- part 1 (button) -- low flags: 00 -- high flags: 8003 -- rect: left=165 top=135 right=157 bottom=357 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Install Command History ----- HyperTalk script ----- on mouseUp global temp answer "This will modify your Home Stack!" with "Go Ahead" or "Cancel" if it is "cancel" then exit mouseup set the cursor to watch put (long name of this stack) into sourceStack delete first word of sourceStack delete first character of sourceStack delete last character of sourceStack lock screen put the script of cd button "command history scripts" into newscript push card go home put the script of this stack into homescript if homescript contains "setuphistory" then answer "Command History already installed!" with "OK" pop card exit mouseup end if put (long name of this stack) into destStack delete first word of destStack delete first character of destStack delete last character of destStack pop card rescopy sourceStack,destStack,"XFCN","DeleteMenu" rescopy sourceStack,destStack,"XFCN","NewMenu" rescopy sourceStack,destStack,"XCMD","ShowMenu" rescopy sourceStack,destStack,"XCMD","EnableMenu" rescopy sourceStack,destStack,"XCMD","ChangeMenu" rescopy sourceStack,destStack,"XCMD","CheckMenu" push card go home put return & return & newscript after homescript put homescript into temp put offset("on startup",homescript) into off put ("on startup" & return & "setuphistory" & return) into char off to off+10 of homescript set the script of this stack to homescript startup pop card unlock screen flash end mouseUp -- part 3 (button) -- low flags: 80 -- high flags: 8003 -- rect: left=157 top=311 right=333 bottom=342 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Command History Scripts ----- HyperTalk script ----- --Command History scripts © 1989 by Steve Martin --Shareware fee of $10 should be sent to --Steve Martin --6632 Warm Breeze Lane --Dallas, TX 75248-5021 on arrowkey arrow global msghistory, historyindex if the optionkey is down then if arrow is up then add 1 to historyindex put unquotify(line historyindex of msghistory) into com if (the visible of msg) and (com is msg) then add 1 to historyindex get the number of lines of msghistory if historyindex > it then put 1 into historyindex put unquotify(line historyindex of msghistory) end if if arrow is down then subtract 1 from historyindex get the number of lines of msghistory if historyindex < 1 then put it into historyindex put unquotify(line historyindex of msghistory) end if else pass arrowkey end arrowkey on domenu which global msghistory,history if history is not empty then repeat with x = 1 to history if line x of msghistory is which then put unquotify(which) select empty type return exit domenu end if end repeat end if pass domenu end domenu on idle global msghistory, historyindex,historymenu,lasttick if historyindex is not empty and historymenu is not empty then if (the ticks-lasttick) > 120 then put the ticks into lasttick showmenu historymenu if historyindex > 0 and line historyindex of msghistory <> quotify(msg) then put 0 into historyindex end if end if end if pass idle end idle on returnkey global msghistory, historyindex, history,historymenu if historymenu is not empty then put quotify(the msg) into qmsg if line 1 of msghistory <> qmsg then put qmsg & return before msghistory if history > 1 then repeat with x = 2 to history get line x of msghistory if it is "none" then exit repeat if it is qmsg then delete line x of msghistory exit repeat end if end repeat end if repeat with x = 1 to history if line x of msghistory <> empty then changemenu historymenu,x,line x of msghistory enablemenu historymenu,x,true else exit repeat end repeat end if if the number of lines of msghistory > history then delete last line of msghistory end if put 0 into historyindex end if pass returnkey end returnkey on setuphistory global historyindex,history,historymenu put 0 into historyindex put 15 into history repeat with x = 1 to history put "none" into line x of temp end repeat if historymenu is empty then put newmenu("History",temp) into historymenu repeat with x = 1 to history enablemenu historymenu,x,false end repeat end if end setuphistory function quotify string put quote into q get offset(q,string) repeat while it > 0 put "''" into char it of string get offset(q,string) end repeat return string end quotify function unquotify string put "''" into q get offset(q,string) repeat while it > 0 put quote into char it to it+1 of string get offset(q,string) end repeat return string end unquotify --End of Command History Scripts -- part 5 (field) -- low flags: 00 -- high flags: 0007 -- rect: left=0 top=163 right=293 bottom=512 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 3 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Command History Help -- part contents for card part 5 ----- text ----- This stack may be freely distributed, but the HyperTalk scripts are ©1989 by Steve Martin and may not be sold for profit without my expressed written permission. Do you type messages into the message box? Do you hate to retype long hypertalk commands over and over again? If you do, this is for you. Command History for Hypercard gives you the ability to recall recently typed messages to the message box, or execute them from a menu. The best way to understand it is to try it so... Type "flash" into the message box and type return. Now look in the "History" menu in the menu bar. If you pull it down, you will see the command "flash" in the first line. Select it to execute "flash" again. Now type "beep" into the message box. The "History" menu now has two items, "beep" and "flash". Select whichever you want to execute it. Next, try out the keyboard part. If you hold down the option key and type the up or down arrows, you can cycle through the last 15 commands you have typed into the message box. Try it now and you will alternate between "flash" and "beep". They will not be executed until you press return. Now that you've tried it (and liked it I'm sure!), you will probably want to install it into your home stack so that you can use it all the time. First of all, go to the Home stack and SAVE A COPY. The installation procedure adds new XCMDs and XFCNs and modifies the stack script of your Home stack. If something goes wrong, you want to have a backup! If you have extensively modified your Home Stack scripts, you should read the technical notes below. Otherwise, click on the "Install Command History" button and when the screen flashes, you are done! If you use it, please send the $10 Shareware fee to: Steve Martin 6632 Warm Breeze Lane Dallas, TX 75248-5021 If you have comments or questions please contact me! I can be reached electronically as follows: Compuserve: 72727,1471 Genie: S.MARTIN8 Arpanet: SMARTIN@CSC.TI.COM Also, look for my chapter on Large Stacks in Tricks of the HyperTalk Masters, an upcoming Hayden "Macintosh Library" Book, edited by The Waite Group. Technical Notes -------------- Command History adds the following scripts to your home stack, ArrowKey, DoMenu, Idle, and ReturnKey. If they are already there, you will have to do some script hacking to install the new ones. The easiest way to do this would be to install them as normal and then edit your stack script, renameing the new handlers (CHArrowKey,CHDoMenu, or something like that) and then calling them at the beginning of your own handlers. Special thanks to: Nine to Five Software Company P.O. Box 915 Greenwood, IN 46142 (317) 887-2154 & Michael Long for the Menu management XCMDs and XFCNs. Special thanks also to Alan Josephson and Fred Hollander for beta testing and to my wife Carolyn who wanted a word processor (so I got a Mac II of course!)